Passed
Push — master ( e1efef...d34f83 )
by
unknown
15:24
created

ParagraphMenuItemDispatcher.isAvailable   A

Complexity

Conditions 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
dl 0
loc 3
rs 10
1
import { setBlockType } from 'prosemirror-commands';
2
import AbstractMenuItemDispatcher from './AbstractMenuItemDispatcher';
3
import MenuItem from '../MenuItem';
4
import { svgIcon } from '../MDI';
5
6
export default class ParagraphMenuItemDispatcher extends AbstractMenuItemDispatcher {
7
    static isAvailable(schema) {
8
        return !!schema.nodes.paragraph;
9
    }
10
11
    static getMenuItem(schema) {
12
        if (!this.isAvailable(schema)) {
13
            throw new Error('Paragraph not availabe in Schema!');
14
        }
15
        return new MenuItem({
16
            command: setBlockType(schema.nodes.paragraph),
17
            icon: svgIcon('format-paragraph'),
18
            label: LANG.plugins.prosemirror['label:paragraph'],
0 ignored issues
show
Bug introduced by
The variable LANG seems to be never declared. If this is a global, consider adding a /** global: LANG */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
19
        });
20
    }
21
}
22